﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="MG.HomeO2O.Admin.Login1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>MG集团后台管理</title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script src="Scripts/js/jquery-1.9.0.min.js"></script>
    <script src="Scripts/js/login.js"></script>
    <link href="Scripts/css/login2.css" rel="stylesheet" />
    <script src="Scripts/js/jquery-1.7.2-min.js"></script>
<%--<link href="css/login2.css" rel="styleshet" type="text/css" />--%>
</head>
<body>
<h1>MG集团后台管理<sup>2016</sup></h1>

<div class="login" style="margin-top:50px;">
    
    <div class="header">
        <div class="switch" id="switch"><a class="switch_btn_focus" id="switch_qlogin" href="javascript:void(0);" tabindex="7">快速登录</a>
			<a class="switch_btn" id="switch_login" href="javascript:void(0);" tabindex="8">快速注册</a><div class="switch_bottom" id="switch_bottom" style="position: absolute; width: 64px; left: 0px;"></div>
        </div>
    </div>    
  
    
    <div class="web_qr_login" id="web_qr_login" style="display: block; height: 235px;">    

            <!--登录-->
            <div class="web_login" id="web_login">
               
               
               <div class="login-box">
    
            
			<div class="login_form">
				<form action="" name="loginform" accept-charset="utf-8" id="login_form" class="loginForm" method="post"><input type="hidden" name="did" value="0"/>
               <input type="hidden" name="to" value="log"/>
                <div class="uinArea" id="uinArea">
                <label class="input-tips" for="u">帐号：</label>
                <div class="inputOuter" id="uArea">
                    
                    <input type="text" id="name" name="username" class="inputstyle"/>
                </div>
                </div>
                <div class="pwdArea" id="pwdArea">
               <label class="input-tips" for="p">密码：</label> 
               <div class="inputOuter" id="pArea">
                    
                    <input type="password" id="pwd" name="p" class="inputstyle"/>
                </div>
                </div>
               
                <div style="padding-left:50px;margin-top:20px;"><input type="submit" value="登 录" style="width:150px;" class="button_blue"  id="btLogin"/></div>
              </form>
           </div>
           
            	</div>
               
            </div>
            <!--登录end-->
  </div>

  <!--注册-->
    <div class="qlogin" id="qlogin" style="display: none; ">
   
    <div class="web_login"><form name="form2" id="regUser" accept-charset="utf-8"  action="" method="post">
	      <input type="hidden" name="to" value="reg"/>
		      		       <input type="hidden" name="did" value="0"/>
        <ul class="reg_form" id="reg-ul">
        		<div id="userCue" class="cue">快速注册请注意格式</div>
                <li>
                	
                    <label for="user"  class="input-tips2">用户名：</label>
                    <div class="inputOuter2">
                        <input type="text" id="user" name="user" maxlength="16" class="inputstyle2"/>
                    </div>
                    
                </li>
                
                <li>
                <label for="passwd" class="input-tips2">密码：</label>
                    <div class="inputOuter2">
                        <input type="password" id="passwd"  name="passwd" maxlength="16" class="inputstyle2"/>
                    </div>
                    
                </li>
                <li>
                <label for="passwd2" class="input-tips2">确认密码：</label>
                    <div class="inputOuter2">
                        <input type="password" id="passwd2" name="" maxlength="16" class="inputstyle2" />
                    </div>
                    
                </li>
                
                <li>
                    <div class="inputArea">
                        <input type="button" id="regg"  style="margin-top:10px;margin-left:85px;" class="button_blue" value="同意协议并注册" /> <a href="#" class="zcxy" target="_blank">注册协议</a>
                    </div>
                    
                </li><div class="cl"></div>
            </ul></form>
           
    
    </div>
   
    
    </div>
    <!--注册end-->
</div>
<div class="jianyi">*推荐使用ie8或以上版本ie浏览器或Chrome内核浏览器访问本站</div>
</body></html>
<script type="text/jscript">
    $(function () {
        $("#btLogin").click(function () {
            var name = $("#name").val();
            var pwd = $("#pwd").val();
            $.ajax({
                type: "post",
                url: "Hander/LoginHandler1.ashx",
                data: {
                    p: name,
                    w:pwd
                },
                success: function (data) {
            
                    if(data!="")
                    {
                        
                        alert("登陆成功");
                        location.href = 'Index.aspx';
                        
                    }
                    else
                    {
                        alert("登录失败");
                    }
                }
            })
        })
        $("#regg").click(function () {
        
            var name = $("#user").val();
            var pwd = $("#passwd").val();
            $.ajax({

                type: "post",
                url: "Hander/HandlerRegist.ashx",
                data: {
                    name: name,
                    pwd:pwd

                },

                success: function (data) {
               
                    //if(data==2)
                    //{  
                    //    alert("用户名已存在");
                    //}
                    if(data>0)
                    {
                        alert("注册成功");
                    }
                    else
                    {
                        alert("注册失败");
                    }

                },
                erroy: function () {

                    alert("出错了!");

                }



            })
            if ($('#user').val() == "") {
                $('#user').focus().css({
                    border: "1px solid red",
                    boxShadow: "0 0 2px red"
                });
                $('#userCue').html("<font color='red'><b>×用户名不能为空</b></font>");
                return false;
            }



            if ($('#user').val().length < 4 || $('#user').val().length > 16) {

                $('#user').focus().css({
                    border: "1px solid red",
                    boxShadow: "0 0 2px red"
                });
                $('#userCue').html("<font color='red'><b>×用户名位4-16字符</b></font>");
                return false;

            }
            if ($('#passwd').val().length < pwdmin) {
                $('#passwd').focus();
                $('#userCue').html("<font color='red'><b>×密码不能小于" + pwdmin + "位</b></font>");
                return false;
            }
            if ($('#passwd2').val() != $('#passwd').val()) {
                $('#passwd2').focus();
                $('#userCue').html("<font color='red'><b>×两次密码不一致！</b></font>");
                return false;
            }
        
                		    		var sqq = /^[1-9]{1}[0-9]{4,9}$/;
                		    		if (!sqq.test($('#qq').val()) || $('#qq').val().length < 5 || $('#qq').val().length > 12) {
                		    		    $('#qq').focus().css({
                		    		        border: "1px solid red",
                		    		        boxShadow: "0 0 2px red"
                		    		    })
                		    		}

        })

    })
    


        

      
</script>


